Skip to content

feat(ci): 自动镜像插件商店索引、安装包与图标到 CNB - #121

Merged
1lck merged 1 commit into
mainfrom
feat/cnb-mirror
Dec 1, 2026
Merged

1lck merged 1 commit into
mainfrom
feat/cnb-mirror

Conversation

@1lck

@1lck 1lck commented Dec 1, 2026

Copy link
Copy Markdown
Contributor

改动类型

  • 收录新插件
  • 新增版本
  • 修改插件信息
  • 撤回版本 / 下架插件(请写明原因)
  • 脚本、CI 或文档

插件

自检

  • [N/A] 我是该插件的作者或维护者(或已获得授权) — 本 PR 不新增或修改单个插件条目,仅增加仓库级 CNB 镜像同步脚本与工作流
  • [N/A] plugin.json 的 vendor.signatureRequirement 为 "none",ID 不在 dev.lithe.* — 未修改插件清单或索引数据
  • [N/A] 已在本地运行 node scripts/validate-index.mjs --verify-archives — 未修改 lithe-plugin-index.json;已运行完整测试 node --test scripts/mirror-cnb.test.mjs scripts/store.test.mjs(61/61 通过)
  • [N/A] 插件要运行的程序都已在 plugin.json 中声明,并在仓库 README 中说明 — 未新增或修改插件条目
  • [N/A] 没有修改已发布版本的 downloadURL / sha256,没有删除历史版本(撤回除外) — 未修改 lithe-plugin-index.json 或 GitHub Releases 历史版本

改动说明

  • 新增 scripts/mirror-cnb.mjs:
    • 将 main 的 lithe-plugin-index.json、lithe-plugin-deltas.json、lithe-plugin-recommendations.json 与仓库状态推送至 https://cnb.cool/lithe-idea/Lithe-store。
    • 按每个插件同步 plugin-<plugin-id> Release:默认保留最新 3 个版本(若更老版本对应不同的 pluginAPIVersion,最多额外保留 2 个回退版本)及对应 .lithe-delta 补丁,下载后按索引 SHA-256 校验再上传;通过 .mirror-checksums.json 跳过未变更资产,并自动清理过期资产与已下架插件的 CNB Release。
    • 将索引引用到的 SVG 图标集中同步到 plugin-icons Release(自动按 <plugin-id>.svg 命名并清理不再使用的图标)。
  • 新增 scripts/mirror-cnb.test.mjs:覆盖版本选择(含不同 pluginAPIVersion 回退保留)、增量补丁与图标同步、跳过未变资产及清理过期资产/已下架插件 Release。
  • 新增 .github/workflows/mirror-cnb.yml:在 main 更新索引、增量、推荐、图标或脚本时自动触发,也支持通过 workflow_dispatch 按 plugin 或 keep_versions 手动触发;未配置 CNB_TOKEN 时安全跳过。

验证

  • node --test scripts/mirror-cnb.test.mjs scripts/store.test.mjs:61/61 通过。
  • actionlint .github/workflows/mirror-cnb.yml:通过(0 报错)。
  • 未能在本地验证项:合入 main 后携带 CNB_TOKEN 执行真实上传与首次全量同步(需在合入后手动触发一次 Mirror to CNB 工作流完成首批镜像同步)。

@1lck
1lck requested a review from xiaoyumuxi as a code owner December 1, 2026 10:23
@1lck
1lck merged commit 578b7b8 into main Dec 1, 2026
1 check passed
@1lck
1lck deleted the feat/cnb-mirror branch December 1, 2026 10:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant